﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;

namespace DATA
{
   public  class BannerREP
    {

        MODELGENERALDataContext context = new MODELGENERALDataContext();


        public List<BannerDTO> GetAllBanners()
        {
            List<BannerDTO> acc = new List<BannerDTO>();

            var acounts = from a in context.Banners
                          select a;
            foreach (var account in acounts)
            {
                BannerDTO ban = new BannerDTO();
                ban.BannerID = account.bannerID;
                ban.BannerName = account.bannerName;
                ban.IsActived = true;
                ban.Link = account.link;
                ban.Picture = account.picture;
                acc.Add(ban);
            }
            return acc;
        }

        public List<BannerDTO> GetActiveBanner()
        {
            List<BannerDTO> acc = new List<BannerDTO>();

            var acounts = from a in context.Banners
                          where a.isActived == true
                          select a;
            foreach (var account in acounts)
            {
                BannerDTO ban = new BannerDTO();
                ban.BannerID = account.bannerID;
                ban.BannerName = account.bannerName;
                ban.IsActived = true;
                ban.Link = account.link;
                ban.Picture = account.picture;
                acc.Add(ban);
            }
            return acc;
        }


    
    }
}
